<?php
$mysql = new SaeMysql();
$sql = "SELECT SUM(wx_lottery_num) FROM `wx_lottery`";
$data = $mysql->getData($sql);
$sum = $data[0]['SUM(wx_lottery_num)'];
echo $sum;

$sql = "SELECT DISTINCT `wx_wall_name`, `wx_wall_openid` FROM `wx_wall`";
$data = $mysql->getData($sql);
print_r($data);
// echo count($data);

$num = $_GET['num'];
echo $num;

$rand = array();
$arr = range(0, count($data)-1);
print_r($arr);
$arrr = array_rand($arr, $num);

$i = 0;
foreach($arrr as $k=>$v){
	$f[$i]['name'] = $data[$v]['wx_wall_name'];
	$f[$i]['openid'] = $data[$v]['wx_wall_openid'];
	$i++;
}

print_r($arrr);
print_r($f);

$json = json_encode($f);
echo $json;
?>